StrCmp (str1, str2), StrCmp (str1, str2, compare)
Basic and Crystal syntax.
Arguments
- str1 is the first text string to be compared.
- str2 is the second text string to be compared.
- compare is an optional Number value indicating the kind of string comparison to use:
Returns
Whole Number where
- -1 = Less Than
- 0 = Equal To
- 1 = Greater Than
Action
The StrCmp function compares two strings.
Typical Uses
Use this function to determine if two string values are identical.
Examples
The following examples are applicable to both Basic and Crystal syntax:
StrCmp("abcd", "aa")
Returns = 1.
StrCmp("abcd", "aa", 1)
Returns = 1.
StrCmp ("abcd", "ac")
Returns = -1.
StrCmp ("aa", "aa")
Returns = 0.
Comments
This function is designed to work like the Visual Basic function of the same name.